@echo off
rem -------------------------------------------------------------------------
rem Batch file to publish the org.brophy.js library to GoDaddy.com
rem 
rem Notes:
rem  - Username: mbrophy
rem  - Password: Standard GoDaddy ftp password
rem -------------------------------------------------------------------------

rem Turn echo back on if ECHO environment variable equals ON.
if not "%ECHO%"=="" echo %ECHO%

rem Detect incorrect params.
if "%1" == "-?" goto USAGE
if "%1" == "" goto USAGE

rem ------------------------------------
rem Cleanup backup files
rem ------------------------------------
del /Q demo\*~
del /Q org\brophy\css\*~
del /Q org\brophy\css\*~

rem ------------------------------------
rem Login to FTP site and move to root directory.
rem ------------------------------------
echo mbrophy> ftp.tmp
echo %1>> ftp.tmp
echo cd brophy.org/code/jslib >> ftp.tmp

rem Send all files.
:SEND_ALL
echo ascii >> ftp.tmp

rem -------------------------------------
rem Move MochiKit Code
rem -------------------------------------
echo cd MochiKit >> ftp.tmp
echo lcd MochiKit >> ftp.tmp
echo mput *.js >> ftp.tmp

rem -------------------------------------
rem Move Demo pages
rem -------------------------------------
echo cd ../demo >> ftp.tmp
echo lcd ../demo >> ftp.tmp
echo mput *.html >> ftp.tmp
echo mput *.js >> ftp.tmp
echo mput *.css >> ftp.tmp

rem -------------------------------------
rem Move top level of doc directory
rem -------------------------------------
echo cd ../doc >> ftp.tmp
echo lcd ../doc >> ftp.tmp
echo mput *.html >> ftp.tmp

rem -------------------------------------
rem Move doc subdirectories
rem -------------------------------------
echo cd symbols >> ftp.tmp
echo lcd symbols >> ftp.tmp
echo mput *.html >> ftp.tmp

echo cd src >> ftp.tmp
echo lcd src >> ftp.tmp
echo mput *.html >> ftp.tmp

echo cd ../../.. >> ftp.tmp
echo lcd ../../.. >> ftp.tmp

rem -------------------------------------
rem Move the org.brophy.js.library
rem -------------------------------------
echo cd org/brophy >> ftp.tmp
echo lcd org/brophy >> ftp.tmp
echo cd css >> ftp.tmp
echo lcd css >> ftp.tmp
echo mput *.css >> ftp.tmp
echo cd ../js >> ftp.tmp
echo lcd ../js >> ftp.tmp
echo mput *.js >> ftp.tmp

echo bye >> ftp.tmp

goto EXECUTE

rem Execute FTP script generated above.
:EXECUTE
ftp -i -s:ftp.tmp ftp.brophy.org
del ftp.tmp
goto EXIT

:EXIT
rem Give the user a chance to see the results or usage or whatever.
rem Then clear the screen to hide the password.
pause
cls
goto END

:USAGE
echo Usage: %0 [password]
goto END

:END
